package com.itheima.mycountdownlatch.腾讯会议;

import java.util.Random;
import java.util.concurrent.CountDownLatch;

public class ChileThread extends Thread {
    private CountDownLatch countDownLatch;
    Random r = new Random();

    public ChileThread(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }


    @Override
    public void run() {
        try {
            int second = r.nextInt(5);
            Thread.sleep(5*1000);
            System.out.println(getName() + "到了");
            //计数器减一
            countDownLatch.countDown();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
